/*******************************************************************************
 * Copyright (c) 2012 joey.enfield.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v3.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/gpl.html
 * 
 * Contributors:
 *     joey.enfield - initial API and implementation
 ******************************************************************************/
package com.joey.software.imageToolkit.colorMapping;

import java.awt.Color;
import java.io.Serializable;
import java.security.InvalidParameterException;
import java.util.HashMap;
import java.util.StringTokenizer;

/*
 * This is the base class for different colour maps. 
 */
public class ColorMap implements Serializable
{
	/**
	 * 
	 */
	private static final long serialVersionUID = -6005920442200059200L;

	HashMap<Integer, Color> map = new HashMap<Integer, Color>();

	String mapName = "";

	public ColorMap(String data)
	{
		setDataString(data);
	}

	public ColorMap()
	{

	}

	@Override
	public String toString()
	{
		return mapName;
	}

	public int getColorNumber()
	{
		return map.size();
	}
	public Color getColor(int value)
	{
		return map.get(value);
	}

	public Color getColor(float value)
	{
		if (value > 1)
		{
			value = 1;
		}
		if (value < 0)
		{
			value = 0;
		}
		float pos = 255 * value;

		return getColor(Math.round(pos));

	}

	public Color getColorInterpolate(float value)
	{
		if(value < 0 || value > 1)
		{
			throw new InvalidParameterException("Color should be in range 0 - 1 : "+value);
		}
		float pos = 255 * value;
		int max = (int) Math.ceil(pos);
		int min = (int) Math.floor(pos);

		pos = pos - min;
		Color colMin = getColor(min);
		Color colMax = getColor(max);

		int r = (int) (colMin.getRed() + (colMax.getRed() - colMin.getRed())
				* pos);
		int g = (int) (colMin.getGreen() + (colMax.getGreen() - colMin
				.getGreen()) * pos);
		int b = (int) (colMin.getBlue() + (colMax.getBlue() - colMin.getBlue())
				* pos);

		return new Color(r, g, b);
	}

	public String getDataString()
	{
		StringBuffer out = new StringBuffer();
		out.append("\"");
		for (int key : map.keySet())
		{
			out.append(key);
			out.append(',');
			out.append(map.get(key).getRGB());
			out.append("\\n");
		}
		out.append("\"");

		return out.toString();
	}

	public void setDataString(String s)
	{
		StringTokenizer lines = new StringTokenizer(s, "\n");
		while (lines.hasMoreTokens())
		{
			String data = lines.nextToken();
			String[] d = data.split(",");
			int key = Integer.parseInt(d[0]);
			int val = Integer.parseInt(d[1]);
			map.put(key, new Color(val));
		}
	}

	public static int TYPE_GRAY = 0;

	public static int TYPE_1 = 1;

	public static int TYPE_2 = 2;

	public static int TYPE_3 = 3;

	public static int TYPE_4 = 4;

	public static int TYPE_RAINBOW = 5;

	public static int TYPE_FIRE = 6;

	public static int TYPE_FIRE_BALL = 7;

	public static int TYPE_ICE = 8;

	public static int TYPE_STONE = 9;

	public static int TYPE_ROSE = 10;

	public static int TYPE_ICE_STORM = 11;

	public static int TYPE_TIVI = 12;

	public static int TYPE_GLOW = 13;

	public static int TOTAL_MAPS = 14;

	public static ColorMap getColorMap(int type)
	{
		if (type == 0)
		{
			ColorMap c = new ColorMap(
					"0,-16777216\n1,-16777216\n2,-16777216\n3,-16711423\n4,-16645630\n5,-16579837\n6,-16514044\n7,-16448251\n8,-16382458\n9,-16316665\n10,-16250872\n11,-16185079\n12,-16119286\n13,-16053493\n14,-15987700\n15,-15921907\n17,-15790321\n16,-15856114\n19,-15658735\n18,-15724528\n21,-15527149\n20,-15592942\n23,-15395563\n22,-15461356\n25,-15263977\n24,-15329770\n27,-15132391\n26,-15198184\n29,-15000805\n28,-15066598\n31,-14869219\n30,-14935012\n34,-14671840\n35,-14606047\n32,-14803426\n33,-14737633\n38,-14408668\n39,-14342875\n36,-14540254\n37,-14474461\n42,-14145496\n43,-14079703\n40,-14277082\n41,-14211289\n46,-13882324\n47,-13816531\n44,-14013910\n45,-13948117\n51,-13553359\n50,-13619152\n49,-13684945\n48,-13750738\n55,-13290187\n54,-13355980\n53,-13421773\n52,-13487566\n59,-13027015\n58,-13092808\n57,-13158601\n56,-13224394\n63,-12763843\n62,-12829636\n61,-12895429\n60,-12961222\n68,-12434878\n69,-12369085\n70,-12303292\n71,-12237499\n64,-12698050\n65,-12632257\n66,-12566464\n67,-12500671\n76,-11908534\n77,-11842741\n78,-11776948\n79,-11711155\n72,-12171706\n73,-12105913\n74,-12040120\n75,-11974327\n85,-11316397\n84,-11382190\n87,-11184811\n86,-11250604\n81,-11579569\n80,-11645362\n83,-11447983\n82,-11513776\n93,-10790053\n92,-10855846\n95,-10658467\n94,-10724260\n89,-11053225\n88,-11119018\n91,-10921639\n90,-10987432\n102,-10197916\n103,-10132123\n100,-10329502\n101,-10263709\n98,-10461088\n99,-10395295\n96,-10592674\n97,-10526881\n110,-9671572\n111,-9605779\n108,-9803158\n109,-9737365\n106,-9934744\n107,-9868951\n104,-10066330\n105,-10000537\n119,-9079435\n118,-9145228\n117,-9211021\n116,-9276814\n115,-9342607\n114,-9408400\n113,-9474193\n112,-9539986\n127,-8553091\n126,-8618884\n125,-8684677\n124,-8750470\n123,-8816263\n122,-8882056\n121,-8947849\n120,-9013642\n137,-7895161\n136,-7960954\n139,-7763575\n138,-7829368\n141,-7631989\n140,-7697782\n143,-7500403\n142,-7566196\n129,-8421505\n128,-8487298\n131,-8289919\n130,-8355712\n133,-8158333\n132,-8224126\n135,-8026747\n134,-8092540\n152,-6908266\n153,-6842473\n154,-6776680\n155,-6710887\n156,-6645094\n157,-6579301\n158,-6513508\n159,-6447715\n144,-7434610\n145,-7368817\n146,-7303024\n147,-7237231\n148,-7171438\n149,-7105645\n150,-7039852\n151,-6974059\n171,-5658199\n170,-5723992\n169,-5789785\n168,-5855578\n175,-5395027\n174,-5460820\n173,-5526613\n172,-5592406\n163,-6184543\n162,-6250336\n161,-6316129\n160,-6381922\n167,-5921371\n166,-5987164\n165,-6052957\n164,-6118750\n186,-4671304\n187,-4605511\n184,-4802890\n185,-4737097\n190,-4408132\n191,-4342339\n188,-4539718\n189,-4473925\n178,-5197648\n179,-5131855\n176,-5329234\n177,-5263441\n182,-4934476\n183,-4868683\n180,-5066062\n181,-5000269\n205,-3421237\n204,-3487030\n207,-3289651\n206,-3355444\n201,-3684409\n200,-3750202\n203,-3552823\n202,-3618616\n197,-3947581\n196,-4013374\n199,-3815995\n198,-3881788\n193,-4210753\n192,-4276546\n195,-4079167\n194,-4144960\n220,-2434342\n221,-2368549\n222,-2302756\n223,-2236963\n216,-2697514\n217,-2631721\n218,-2565928\n219,-2500135\n212,-2960686\n213,-2894893\n214,-2829100\n215,-2763307\n208,-3223858\n209,-3158065\n210,-3092272\n211,-3026479\n239,-1184275\n238,-1250068\n237,-1315861\n236,-1381654\n235,-1447447\n234,-1513240\n233,-1579033\n232,-1644826\n231,-1710619\n230,-1776412\n229,-1842205\n228,-1907998\n227,-1973791\n226,-2039584\n225,-2105377\n224,-2171170\n254,-197380\n255,-131587\n252,-328966\n253,-263173\n250,-460552\n251,-394759\n248,-592138\n249,-526345\n246,-723724\n247,-657931\n244,-855310\n245,-789517\n242,-986896\n243,-921103\n240,-1118482\n241,-1052689\n");
			c.setMapName("Gray Scale");
			return c;
		} else if (type == TYPE_1)
		{
			ColorMap c = new ColorMap(
					"0,-1244668\n1,-1113340\n2,-653561\n3,-390393\n4,-455933\n5,-520446\n6,-387324\n7,-452349\n8,-517885\n9,-319738\n10,-384507\n11,-515326\n12,-580094\n13,-447997\n14,-381692\n15,-446717\n17,-379129\n16,-379898\n19,-509438\n18,-443643\n21,-507390\n20,-442622\n23,-505340\n22,-440572\n25,-371704\n24,-438522\n27,-501501\n26,-502012\n29,-368634\n28,-500989\n31,-433402\n30,-433657\n34,-496123\n35,-560381\n32,-367098\n33,-365817\n38,-427515\n39,-360954\n36,-428026\n37,-427771\n42,-555005\n43,-356345\n40,-359929\n41,-424699\n46,-288760\n47,-353785\n44,-487164\n45,-552701\n51,-350202\n50,-416507\n49,-483580\n48,-418811\n55,-347128\n54,-479739\n53,-414714\n52,-480763\n59,-408826\n58,-606972\n57,-410618\n56,-477947\n63,-340217\n62,-341496\n61,-408313\n60,-343034\n68,-599290\n69,-335352\n70,-334841\n71,-465402\n64,-470779\n65,-535291\n66,-468473\n67,-599546\n76,-462074\n77,-395769\n78,-329464\n79,-460281\n72,-530170\n73,-331768\n74,-462586\n75,-462330\n85,-919290\n84,-722682\n87,-1443320\n86,-1181177\n81,-525818\n80,-460025\n83,-525816\n82,-460025\n93,-2492154\n92,-2229497\n95,-3147257\n94,-2950650\n89,-1836793\n88,-1639929\n91,-2033144\n90,-1902329\n102,-4523515\n103,-4851194\n100,-3999482\n101,-4195834\n98,-3540472\n99,-3802874\n96,-3278072\n97,-3540729\n110,-6292985\n111,-6555129\n108,-5637625\n109,-5965561\n106,-5244666\n107,-5441274\n104,-4982266\n105,-5113594\n119,-8062458\n118,-7800058\n117,-7538171\n116,-7342075\n115,-7079675\n114,-6817274\n113,-6751482\n112,-6686201\n127,-9897723\n126,-9635323\n125,-9373435\n124,-9111548\n123,-8783355\n122,-8652538\n121,-8455674\n120,-8324347\n137,-11863291\n136,-11666939\n139,-12257018\n138,-11994619\n141,-12781050\n140,-12453369\n143,-13370875\n142,-13108988\n129,-10159355\n128,-10094075\n131,-10683899\n130,-10356219\n133,-11142650\n132,-10880506\n135,-11601403\n134,-11404795\n152,-14812666\n153,-15140604\n154,-15468284\n155,-15730171\n156,-15926779\n157,-16254460\n158,-16319995\n159,-16451069\n144,-13436411\n145,-13501947\n146,-13829628\n147,-14092028\n148,-14288123\n149,-14550779\n150,-14616059\n151,-14747386\n171,-16451044\n170,-16451306\n169,-16451055\n168,-16385522\n175,-16516572\n174,-16451038\n173,-16451040\n172,-16451041\n163,-16516601\n162,-16516603\n161,-16451068\n160,-16451069\n167,-16451060\n166,-16451062\n165,-16451063\n164,-16516600\n186,-16516536\n187,-16450998\n184,-16451007\n185,-16516539\n190,-16450991\n191,-16516267\n188,-16450998\n189,-16451250\n178,-16516818\n179,-16516815\n176,-16451033\n177,-16451029\n182,-16516551\n183,-16451011\n180,-16451018\n181,-16451017\n205,-16450945\n204,-16516742\n207,-16450937\n206,-16450942\n201,-16450955\n200,-16450958\n203,-16516487\n202,-16516489\n197,-16385689\n196,-16320154\n199,-16385426\n198,-16385430\n193,-16516772\n192,-16516519\n195,-16319901\n194,-16516513\n220,-16450896\n221,-16450893\n222,-16450889\n223,-16450888\n216,-16516701\n217,-16450903\n218,-16450900\n219,-16450898\n212,-16450921\n213,-16450920\n214,-16385380\n215,-16451169\n208,-16450932\n209,-16516463\n210,-16450924\n211,-16385385\n239,-16516372\n238,-16450842\n237,-16385310\n236,-16385313\n235,-16450852\n234,-16319780\n233,-16319781\n232,-16450858\n231,-16451117\n230,-16385329\n229,-16385333\n228,-16385593\n227,-16385853\n226,-16451136\n225,-16450882\n224,-16516422\n254,-16323846\n255,-16455943\n252,-16387848\n253,-16323079\n250,-16386312\n251,-16452617\n248,-16450822\n249,-16385287\n246,-16385288\n247,-16450823\n244,-16450571\n245,-16385033\n242,-16516366\n243,-16516365\n240,-16450832\n241,-16450830\n");
			c.setMapName("Highlighter");
			return c;
		} else if (type == TYPE_2)
		{
			ColorMap c = new ColorMap(
					"0,-16448229\n1,-16448219\n2,-16711114\n3,-16513973\n4,-16579747\n5,-16776848\n6,-16776584\n7,-16776835\n8,-16777086\n9,-16711535\n10,-16645993\n11,-16711524\n12,-16711519\n13,-16645975\n14,-16580435\n15,-16645708\n17,-16711483\n16,-16645959\n19,-16580143\n18,-16645940\n21,-16711460\n20,-16711211\n23,-16514586\n22,-16580127\n25,-16514837\n24,-16580375\n27,-15072777\n26,-15597325\n29,-14022914\n28,-14481924\n31,-12975106\n30,-13500165\n34,-11861766\n35,-11468291\n32,-12581634\n33,-12320003\n38,-10682115\n39,-10353922\n36,-11074818\n37,-10878466\n42,-9436418\n43,-9240066\n40,-10223106\n41,-10157828\n46,-8847110\n47,-8322050\n44,-9109252\n45,-8846851\n51,-7404802\n50,-7864068\n49,-8060419\n48,-8191491\n55,-6487042\n54,-7077379\n53,-7142914\n52,-7339523\n59,-5831938\n58,-6225669\n57,-6356741\n56,-6356482\n63,-5242113\n62,-5438979\n61,-5766917\n60,-5832453\n68,-4389889\n69,-4193538\n70,-3996930\n71,-3668994\n64,-5176834\n65,-5046019\n66,-4914947\n67,-4652291\n76,-3014147\n77,-2948098\n78,-2817282\n79,-2685954\n72,-3472899\n73,-3341572\n74,-3210499\n75,-3144962\n85,-1637380\n84,-1768709\n87,-1375237\n86,-1506053\n81,-2227458\n80,-2424065\n83,-1833986\n82,-2030850\n93,-588557\n92,-653833\n95,-588561\n94,-588559\n89,-850949\n88,-1047045\n91,-653831\n90,-719878\n102,-457763\n103,-392228\n100,-588831\n101,-523298\n98,-588571\n99,-588830\n96,-588563\n97,-588569\n110,-523320\n111,-588857\n108,-523058\n109,-523316\n106,-523309\n107,-523312\n104,-457766\n105,-523563\n119,-719699\n118,-719952\n117,-588362\n116,-588105\n115,-588359\n114,-588614\n113,-588863\n112,-589116\n127,-589163\n126,-523625\n125,-589156\n124,-523104\n123,-588895\n122,-719966\n121,-719705\n120,-719702\n137,-719758\n136,-654475\n139,-654231\n138,-654737\n141,-588958\n140,-719772\n143,-719787\n142,-654498\n129,-523373\n128,-523372\n131,-589174\n130,-523633\n133,-654206\n132,-588921\n135,-654217\n134,-654211\n152,-912867\n153,-1240303\n154,-120036\n155,-184813\n156,-708351\n157,-509693\n158,-113142\n159,-177401\n144,-719790\n145,-719793\n146,-654262\n147,-588736\n148,-588228\n149,-654026\n150,-784848\n151,-981720\n171,-492798\n170,-361980\n169,-428284\n168,-626431\n175,-488446\n174,-291578\n173,-424188\n172,-558079\n163,-238331\n162,-173307\n161,-502783\n160,-767232\n167,-365307\n166,-234233\n165,-367100\n164,-631296\n186,-151804\n187,-348159\n184,-351488\n185,-86523\n190,-214013\n191,-410880\n188,-478976\n189,-280318\n178,-419839\n179,-551168\n176,-816128\n177,-486143\n182,-155133\n183,-286207\n180,-550912\n181,-221181\n205,-269822\n204,-401664\n207,-203260\n206,-269566\n201,-272382\n200,-470272\n203,-402432\n202,-402688\n197,-79100\n196,-342528\n199,-405760\n198,-209151\n193,-278782\n192,-476416\n195,-408832\n194,-211965\n220,-66217\n221,-65952\n222,-65690\n223,-65932\n216,-330213\n217,-66514\n218,-65990\n219,-131507\n212,-68604\n213,-134141\n214,-330748\n215,-330735\n208,-466176\n209,-70650\n210,-266749\n211,-332286\n239,-36\n238,-65833\n237,-66096\n236,-65845\n235,-131649\n234,-131398\n233,-65608\n232,-331\n231,-66126\n230,-131416\n229,-65630\n228,-131429\n227,-197228\n226,-65911\n225,-131454\n224,-131460\n254,-2\n255,-2\n252,-3\n253,-3\n250,-3\n251,-3\n248,-516\n249,-3\n246,-260\n247,-514\n244,-65803\n245,-66056\n242,-278\n243,-131344\n240,-285\n241,-25\n");
			c.setMapName("Deep Ligh");
			return c;
		} else if (type == TYPE_3)
		{
			ColorMap c = new ColorMap(
					"0,-16777216\n1,-16777216\n2,-16777216\n3,-16777216\n4,-16777216\n5,-16777216\n6,-16777216\n7,-16777216\n8,-16777216\n9,-16777216\n10,-16777216\n11,-16777216\n12,-16777216\n13,-16777216\n14,-16711423\n15,-16711423\n17,-16579837\n16,-16645630\n19,-16448251\n18,-16514044\n21,-16316665\n20,-16382458\n23,-16185079\n22,-16185079\n25,-15987700\n24,-16053493\n27,-15856112\n26,-15921905\n29,-15724526\n28,-15790319\n31,-15658733\n30,-15724526\n34,-15461354\n35,-15461354\n32,-15592940\n33,-15527147\n38,-15263718\n39,-15197925\n36,-15395561\n37,-15329511\n42,-15000546\n43,-15000546\n40,-15132132\n41,-15000546\n46,-14933981\n47,-14868188\n44,-14803167\n45,-14868960\n51,-14539223\n50,-14736602\n49,-14736602\n48,-14802395\n55,-14407637\n54,-14341844\n53,-14539223\n52,-14539223\n59,-14210001\n58,-14275794\n57,-14341587\n56,-14407380\n63,-14077132\n62,-14142925\n61,-14274511\n60,-14275537\n68,-13944519\n69,-13878726\n70,-13878726\n71,-13812420\n64,-14076619\n65,-14010826\n66,-13945033\n67,-14010312\n76,-13680064\n77,-13614271\n78,-13614014\n79,-13548221\n72,-13746627\n73,-13811650\n74,-13745857\n75,-13680064\n85,-13284536\n84,-13350329\n87,-13284282\n86,-13350075\n81,-13548221\n80,-13416635\n83,-13350842\n82,-13416635\n93,-13085624\n92,-13217210\n95,-13019317\n94,-13150903\n89,-13217975\n88,-13152696\n91,-13151928\n90,-13086389\n102,-13018294\n103,-12886708\n100,-13018806\n101,-13018293\n98,-13150392\n99,-13018806\n96,-13085110\n97,-13150392\n110,-12753074\n111,-12818613\n108,-12819380\n109,-12884659\n106,-13017013\n107,-12950966\n104,-12951731\n105,-12951731\n119,-12751034\n118,-12816824\n117,-12751799\n116,-12817592\n115,-12752313\n114,-12752313\n113,-12818105\n112,-12818615\n127,-12748988\n126,-12749500\n125,-12749500\n124,-12749500\n123,-12684475\n122,-12750266\n121,-12816059\n120,-12751035\n137,-12418757\n136,-12549827\n139,-12156099\n138,-12221892\n141,-11958979\n140,-12024513\n143,-11827393\n142,-11958979\n129,-12617148\n128,-12682941\n131,-12748226\n130,-12617150\n133,-12681409\n132,-12682433\n135,-12484032\n134,-12615618\n152,-11104196\n153,-10972611\n154,-10775748\n155,-10775749\n156,-10578630\n157,-10513352\n158,-10381511\n159,-10184132\n144,-11761602\n145,-11695809\n146,-11498945\n147,-11498947\n148,-11367107\n149,-11301316\n150,-11301316\n151,-11169730\n171,-8477384\n170,-8739783\n169,-8871112\n168,-8871110\n175,-7952072\n174,-8214727\n173,-8214727\n172,-8345798\n163,-9724614\n162,-9921478\n161,-9921478\n160,-10118340\n167,-9133766\n166,-9264837\n165,-9527750\n164,-9527750\n186,-5983180\n187,-5852110\n184,-6507721\n185,-6245322\n190,-5129935\n191,-4867792\n188,-5589711\n189,-5457870\n178,-7427275\n179,-7295689\n176,-7821002\n177,-7624139\n182,-6901708\n183,-6704843\n180,-7164104\n181,-7098572\n205,-3625431\n204,-3755990\n207,-3561178\n206,-3560408\n201,-3820500\n200,-4016596\n203,-3821270\n202,-3821013\n197,-4146644\n196,-4211924\n199,-4081619\n198,-4081619\n193,-4539601\n192,-4736465\n195,-4342738\n194,-4408015\n220,-2585825\n221,-2521057\n222,-2521570\n223,-2390754\n216,-2845661\n217,-2780637\n218,-2650078\n219,-2650591\n212,-3104986\n213,-3171292\n214,-3040476\n215,-2844381\n208,-3496155\n209,-3430619\n210,-3431389\n211,-3169755\n239,-1421296\n238,-1486576\n237,-1681647\n236,-1615342\n235,-1614574\n234,-1548013\n233,-1612780\n232,-1939437\n231,-1873131\n230,-2003177\n229,-2067688\n228,-2001638\n227,-2066404\n226,-2131429\n225,-2327525\n224,-2457317\n254,-193279\n255,-325632\n252,-518397\n253,-323839\n250,-581884\n251,-451836\n248,-579576\n249,-646138\n246,-774392\n247,-774903\n244,-902645\n245,-903927\n242,-1228276\n243,-1098741\n240,-1357042\n241,-1161970\n");
			c.setMapName("Flower");
			return c;
		} else if (type == TYPE_4)
		{
			ColorMap c = new ColorMap(
					"0,-15794176\n1,-15662846\n2,-15662847\n3,-15531775\n4,-15466495\n5,-15073020\n6,-14811134\n7,-14811136\n8,-14679808\n9,-14221054\n10,-14090238\n11,-13893631\n12,-13762560\n13,-13696767\n14,-13434622\n15,-13369088\n17,-12910336\n16,-13238272\n19,-12647935\n18,-12845056\n21,-12255232\n20,-12517375\n23,-11796478\n22,-11927294\n25,-11796480\n24,-11927551\n27,-11337469\n26,-11534078\n29,-11010048\n28,-11206656\n31,-10616832\n30,-10747390\n34,-9895678\n35,-9895935\n32,-10420223\n33,-10223616\n38,-9240319\n39,-8978430\n36,-9699328\n37,-9502720\n42,-8781309\n43,-8650493\n40,-9043965\n41,-8912895\n46,-7929598\n47,-7864318\n44,-8454143\n45,-8126464\n51,-7012095\n50,-7339775\n49,-7667711\n48,-7864320\n55,-6553086\n54,-6815488\n53,-7012352\n52,-7012352\n59,-5701376\n58,-5898240\n57,-6094847\n56,-6356992\n63,-5046269\n62,-5308414\n61,-5701632\n60,-5635583\n68,-4259840\n69,-4194304\n70,-3931646\n71,-3669244\n64,-4784124\n65,-4914940\n66,-4915199\n67,-4456190\n76,-3014655\n77,-2883584\n78,-2686976\n79,-2424576\n72,-3670016\n73,-3407872\n74,-3407872\n75,-3079678\n85,-1703934\n84,-1507325\n87,-851966\n86,-1507327\n81,-2162432\n80,-2227455\n83,-1638141\n82,-1835008\n93,-262144\n92,-196352\n95,-62971\n94,-196352\n89,-982784\n88,-720637\n91,-458751\n90,-786432\n102,-59904\n103,-58623\n100,-60415\n101,-191232\n98,-259072\n99,-60669\n96,-128510\n97,-193792\n110,-54784\n111,-119808\n108,-120320\n109,-55040\n106,-319744\n107,-55550\n104,-123904\n105,-123392\n119,-179456\n118,-48638\n117,-115200\n116,-115967\n115,-50428\n114,-248064\n113,-248832\n112,-117758\n127,-174336\n126,-109312\n125,-43775\n124,-44544\n123,-111360\n122,-46336\n121,-46591\n120,-46845\n137,-36094\n136,-167935\n139,-166400\n138,-101120\n141,-33024\n140,-33535\n143,-229888\n142,-33024\n129,-41215\n128,-41216\n131,-106240\n130,-172544\n133,-38652\n132,-39163\n135,-300544\n134,-234750\n152,-25856\n153,-24832\n154,-90112\n155,-155904\n156,-23040\n157,-22015\n158,-22015\n159,-218367\n144,-96765\n145,-29951\n146,-29952\n147,-29696\n148,-28413\n149,-93949\n150,-28158\n151,-92672\n171,-210688\n170,-79615\n169,-14336\n168,-212480\n175,-10750\n174,-142590\n173,-77052\n172,-341504\n163,-150015\n162,-84736\n161,-19197\n160,-217343\n167,-212992\n166,-16896\n165,-17408\n164,-149760\n186,-3581\n187,-133888\n184,-267776\n185,-3835\n190,-131840\n191,-255\n188,-264704\n189,-1278\n178,-8957\n179,-73471\n176,-10493\n177,-9210\n182,-6142\n183,-71422\n180,-204544\n181,-6142\n205,-714\n204,-463\n207,-195\n206,-195\n201,-66006\n200,-131548\n203,-465\n202,-211\n197,-235\n196,-496\n199,-224\n198,-487\n193,-247\n192,-508\n195,-497\n194,-244\n220,-143\n221,-142\n222,-65673\n223,-131201\n216,-65952\n217,-65693\n218,-149\n219,-146\n212,-174\n213,-131242\n214,-164\n215,-65954\n208,-193\n209,-442\n210,-438\n211,-179\n239,-66\n238,-326\n237,-332\n236,-590\n235,-338\n234,-65880\n233,-97\n232,-97\n231,-351\n230,-65642\n229,-131183\n228,-115\n227,-115\n226,-117\n225,-65915\n224,-65918\n254,-65804\n255,-65542\n252,-65551\n253,-65553\n250,-28\n251,-15\n248,-37\n249,-289\n246,-65832\n247,-37\n244,-131120\n245,-300\n242,-65596\n243,-131123\n240,-63\n241,-65599\n");
			c.setMapName("Hot");
			return c;
		} else if (type == TYPE_RAINBOW)
		{
			ColorMap c = new ColorMap(
					"0,-16777216\n1,-16777214\n2,-16711675\n3,-16777204\n4,-16711664\n5,-16711662\n6,-16777192\n7,-16711649\n8,-16777180\n9,-16711638\n10,-16711634\n11,-16777166\n12,-16777159\n13,-16776900\n14,-16777152\n15,-16777144\n17,-16777134\n16,-16776884\n19,-16777124\n18,-16776874\n21,-16776605\n20,-16777118\n23,-16777106\n22,-16777108\n25,-16711558\n24,-16777100\n27,-16711548\n26,-16777090\n29,-16711540\n28,-16711545\n31,-16777066\n30,-16645996\n34,-16711514\n35,-16711509\n32,-16711524\n33,-16711518\n38,-16777030\n39,-16777024\n36,-16776786\n37,-16777034\n42,-16777012\n43,-16777006\n40,-16777020\n41,-16776762\n46,-16776734\n47,-16776986\n44,-16776745\n45,-16776994\n51,-16711175\n50,-16776970\n49,-16776978\n48,-16776978\n55,-16707091\n54,-16773900\n53,-16775685\n52,-16776962\n59,-16767524\n58,-16768801\n57,-16770331\n56,-16771606\n63,-16697146\n62,-16632883\n61,-16765488\n60,-16766505\n68,-16690515\n69,-16755031\n70,-16753756\n71,-16686944\n64,-16695870\n65,-16694338\n66,-16693321\n67,-16692300\n76,-16745851\n77,-16679292\n78,-16678275\n79,-16742023\n72,-16685673\n73,-16749932\n74,-16683118\n75,-16747127\n85,-16734630\n84,-16735907\n87,-16732083\n86,-16733102\n81,-16739733\n80,-16675469\n83,-16671646\n82,-16738454\n93,-16658895\n92,-16660425\n95,-16721879\n94,-16722902\n89,-16729531\n88,-16665270\n91,-16726726\n90,-16728001\n102,-16712701\n103,-16515583\n100,-16715505\n101,-16714231\n98,-16718057\n99,-16651245\n96,-16655071\n97,-16719332\n110,-14418175\n111,-14024959\n108,-15008000\n109,-14680320\n106,-15598080\n107,-15335934\n104,-16187648\n105,-16056574\n119,-11403520\n118,-11731199\n117,-12058879\n116,-12452096\n115,-12779776\n114,-12845566\n113,-13369599\n112,-13697280\n127,-8651008\n126,-9109759\n125,-9437440\n124,-9699840\n123,-10158335\n122,-10289408\n121,-10617344\n120,-11141376\n137,-5374208\n136,-5701886\n139,-4784384\n138,-5308670\n141,-4260095\n140,-4522240\n143,-3539456\n142,-3801600\n129,-8061440\n128,-8323328\n131,-7536895\n130,-7864576\n133,-6881536\n132,-7012605\n135,-6095357\n134,-6553855\n152,-655616\n153,-131328\n154,-66048\n155,-67328\n156,-3328\n157,-4351\n158,-5888\n159,-6912\n144,-3146240\n145,-2752768\n146,-2556159\n147,-2294016\n148,-1966336\n149,-1638656\n150,-1114367\n151,-983296\n171,-22527\n170,-86528\n169,-85248\n168,-18175\n175,-93184\n174,-26112\n173,-155903\n172,-89599\n163,-11520\n162,-76032\n161,-75264\n160,-8448\n167,-17407\n166,-15871\n165,-14592\n164,-13312\n186,-41984\n187,-43008\n184,-38912\n185,-40192\n190,-46848\n191,-113152\n188,-43776\n189,-45568\n178,-97024\n179,-32767\n176,-28926\n177,-95744\n182,-36607\n183,-168960\n180,-34046\n181,-101119\n205,-130559\n204,-65024\n207,-62709\n206,-63992\n201,-60928\n200,-125440\n203,-63488\n202,-62208\n197,-56064\n196,-54272\n199,-58623\n198,-122368\n193,-50432\n192,-49408\n195,-118784\n194,-51968\n220,-45747\n221,-241069\n222,-43434\n223,-42150\n216,-116934\n217,-49602\n218,-114109\n219,-112823\n212,-56284\n213,-186072\n214,-53457\n215,-52171\n208,-61167\n209,-60140\n210,-58598\n211,-57311\n239,-86866\n238,-22874\n237,-24159\n236,-156258\n235,-92010\n234,-27757\n233,-29299\n232,-96122\n231,-97403\n230,-33154\n229,-34181\n228,-35467\n227,-37523\n226,-38037\n225,-39324\n224,-40608\n254,-2313\n255,-197380\n252,-135699\n253,-3343\n250,-7200\n251,-136985\n248,-10026\n249,-205090\n246,-12337\n247,-77101\n244,-15162\n245,-13879\n242,-17734\n243,-16191\n240,-20305\n241,-150090\n");
			c.setMapName("Rainbow");
			return c;
		} else if (type == TYPE_FIRE)
		{
			ColorMap c = new ColorMap(
					"0,-16579578\n1,-16513784\n2,-16447734\n3,-16381940\n4,-16315890\n5,-16250096\n6,-16184302\n7,-16118253\n8,-16052458\n9,-15986409\n10,-15855079\n11,-15789285\n12,-15723235\n13,-15657441\n14,-15591391\n15,-15525597\n17,-15393753\n16,-15459803\n19,-15262165\n18,-15327959\n21,-15130321\n20,-15196115\n23,-14998477\n22,-15064271\n25,-14866633\n24,-14932427\n27,-14669253\n26,-14800840\n29,-14537410\n28,-14603459\n31,-14405566\n30,-14471616\n34,-14207928\n35,-14142134\n32,-14339772\n33,-14273978\n38,-13944496\n39,-13878446\n36,-14076340\n37,-14010290\n42,-13680808\n43,-13549478\n40,-13812652\n41,-13746858\n46,-13351584\n47,-13285790\n44,-13483428\n45,-13417634\n51,-13022103\n50,-13088152\n49,-13153947\n48,-13219996\n55,-12758671\n54,-12824465\n53,-12890515\n52,-12956309\n59,-12429447\n58,-12495497\n57,-12626827\n56,-12692621\n63,-12166015\n62,-12231809\n61,-12297859\n60,-12363653\n68,-11574915\n69,-11378052\n70,-11246982\n71,-11115655\n64,-12099966\n65,-11968638\n66,-11837568\n67,-11706241\n76,-10393743\n77,-10197136\n78,-10065810\n79,-9934483\n72,-10984329\n73,-10787466\n74,-10656396\n75,-10525069\n85,-9015964\n84,-9212570\n87,-8753311\n86,-8884638\n81,-9606550\n80,-9803156\n83,-9343897\n82,-9475224\n93,-7900328\n92,-8031399\n95,-7572139\n94,-7703466\n89,-8425378\n88,-8621985\n91,-8162725\n90,-8294052\n102,-6587829\n103,-6456503\n100,-6850483\n101,-6719156\n98,-7178415\n99,-6981553\n96,-7440813\n97,-7309742\n110,-5406657\n111,-5275331\n108,-5669310\n109,-5537984\n106,-5997243\n107,-5800381\n104,-6259896\n105,-6128570\n119,-4094415\n118,-4225485\n117,-4356812\n116,-4553674\n115,-4685001\n114,-4816071\n113,-4947398\n112,-5078724\n127,-2913243\n126,-3110105\n125,-3241176\n124,-3372502\n123,-3503829\n122,-3634899\n121,-3831762\n120,-3963088\n137,-2582996\n136,-2583253\n139,-2516946\n138,-2517203\n141,-2450896\n140,-2516689\n143,-2384846\n142,-2450639\n129,-2781659\n128,-2847451\n131,-2715609\n130,-2715866\n133,-2649560\n132,-2715352\n135,-2583510\n134,-2649303\n152,-2185670\n153,-2185413\n154,-2119620\n155,-2119364\n156,-2119107\n157,-2053314\n158,-2053057\n159,-1987264\n144,-2384590\n145,-2384333\n146,-2318284\n147,-2318027\n148,-2317770\n149,-2251977\n150,-2251720\n151,-2185927\n171,-1722037\n170,-1722294\n169,-1788087\n168,-1788344\n175,-1589681\n174,-1655474\n173,-1655731\n172,-1655988\n163,-1920700\n162,-1920957\n161,-1986750\n160,-1987007\n167,-1788601\n166,-1854394\n165,-1854650\n164,-1920443\n186,-1324711\n187,-1324455\n184,-1390761\n185,-1390504\n190,-1258148\n191,-1192355\n188,-1258661\n189,-1258405\n178,-1523375\n179,-1523118\n176,-1589424\n177,-1589167\n182,-1456811\n183,-1391018\n180,-1457325\n181,-1457068\n205,-927361\n204,-993155\n207,-927100\n206,-927103\n201,-1059211\n200,-1059470\n203,-993414\n202,-993417\n197,-1125525\n196,-1125784\n199,-1059728\n198,-1059731\n193,-1191839\n192,-1192097\n195,-1126042\n194,-1126301\n220,-662363\n221,-662105\n222,-661846\n223,-596308\n216,-728677\n217,-728419\n218,-728160\n219,-662622\n212,-794991\n213,-794733\n214,-794474\n215,-794472\n208,-926841\n209,-861047\n210,-860789\n211,-860786\n239,-331052\n238,-331054\n237,-331312\n236,-397107\n235,-397366\n234,-397368\n233,-397627\n232,-463421\n231,-463680\n230,-463682\n229,-529477\n228,-529735\n227,-529994\n226,-529996\n225,-595791\n224,-596049\n254,-65798\n255,-259\n252,-66315\n253,-66056\n250,-132112\n251,-66573\n248,-132629\n249,-132370\n246,-198426\n247,-198424\n244,-198943\n245,-198684\n242,-264740\n243,-264738\n240,-330793\n241,-264998\n");
			c.setMapName("Fire");
			return c;
		} else if (type == TYPE_FIRE_BALL)
		{
			ColorMap c = new ColorMap(
					"0,-16777216\n1,-16645888\n2,-16449280\n3,-16317952\n4,-16121344\n5,-15990016\n6,-15793152\n7,-15662079\n8,-15465215\n9,-15334143\n10,-15137279\n11,-15006207\n12,-14809343\n13,-14678015\n14,-14481407\n15,-14350079\n17,-14022143\n16,-14153471\n19,-13694207\n18,-13825279\n21,-13366270\n20,-13497342\n23,-13038078\n22,-13169406\n25,-12710142\n24,-12841470\n27,-12382206\n26,-12513534\n29,-12054270\n28,-12185342\n31,-11726334\n30,-11857406\n34,-11201533\n35,-11070205\n32,-11529470\n33,-11398141\n38,-10545661\n39,-10414333\n36,-10873597\n37,-10742269\n42,-9889533\n43,-9758461\n40,-10217469\n41,-10086397\n46,-9299196\n47,-9102332\n44,-9561597\n45,-9430268\n51,-8446460\n50,-8643068\n49,-8774396\n48,-8905724\n55,-7790332\n54,-7987196\n53,-8118524\n52,-8249596\n59,-7134459\n58,-7331323\n57,-7462396\n56,-7593724\n63,-6478587\n62,-6675195\n61,-6806523\n60,-6937595\n68,-6018555\n69,-5952763\n70,-5886970\n71,-5821178\n64,-6347259\n65,-6215931\n66,-6150139\n67,-6084347\n76,-5557754\n77,-5491962\n78,-5425914\n79,-5360122\n72,-5820922\n73,-5755130\n74,-5689338\n75,-5623546\n85,-4965369\n84,-5031161\n87,-4833785\n86,-4899577\n81,-5228537\n80,-5294330\n83,-5096953\n82,-5162745\n93,-4439032\n92,-4504824\n95,-4307448\n94,-4373240\n89,-4702201\n88,-4767993\n91,-4570616\n90,-4636409\n102,-3912183\n103,-3846391\n100,-4043768\n101,-3977976\n98,-4175352\n99,-4109560\n96,-4307192\n97,-4241144\n110,-3385847\n111,-3320055\n108,-3517431\n109,-3451639\n106,-3649015\n107,-3583223\n104,-3780599\n105,-3714807\n119,-2859254\n118,-2925046\n117,-2990838\n116,-3056630\n115,-3122422\n114,-3122678\n113,-3188470\n112,-3254263\n127,-2332661\n126,-2398453\n125,-2464245\n124,-2530037\n123,-2595829\n122,-2661622\n121,-2727414\n120,-2793462\n137,-2000626\n136,-2066674\n139,-1934321\n138,-2000113\n141,-1867760\n140,-1933809\n143,-1866991\n142,-1867248\n129,-2266357\n128,-2266869\n131,-2200052\n130,-2200564\n133,-2133491\n132,-2134004\n135,-2067186\n134,-2067443\n152,-1600492\n153,-1534700\n154,-1534187\n155,-1468139\n156,-1467627\n157,-1401834\n158,-1401322\n159,-1400809\n144,-1800943\n145,-1800431\n146,-1734382\n147,-1733870\n148,-1667822\n149,-1667565\n150,-1601517\n151,-1601004\n171,-1002213\n170,-1068261\n169,-1068518\n168,-1134566\n175,-869091\n174,-935140\n173,-935652\n172,-1001700\n163,-1267944\n162,-1268456\n161,-1334249\n160,-1334761\n167,-1135078\n166,-1135591\n165,-1201383\n164,-1201896\n186,-602079\n187,-536031\n184,-668384\n185,-602592\n190,-469214\n191,-403165\n188,-535519\n189,-469470\n178,-802274\n179,-801762\n176,-868579\n177,-868323\n182,-669409\n183,-668896\n180,-735713\n181,-735457\n205,-335281\n204,-335284\n207,-335017\n206,-335021\n201,-335806\n200,-336066\n203,-335543\n202,-335546\n197,-401868\n196,-402127\n199,-336069\n198,-336328\n193,-402394\n192,-402652\n195,-402131\n194,-402390\n220,-201853\n221,-201850\n222,-201590\n223,-201587\n216,-268171\n217,-267911\n218,-267652\n219,-202112\n212,-268696\n213,-268437\n214,-268433\n215,-268174\n208,-334758\n209,-269219\n210,-268959\n211,-268700\n239,-133692\n238,-133695\n237,-133954\n236,-133958\n235,-134217\n234,-134221\n233,-134480\n232,-134740\n231,-134743\n230,-135002\n229,-200542\n228,-200802\n227,-200805\n226,-201064\n225,-201067\n224,-201327\n254,-264\n255,-261\n252,-527\n253,-523\n250,-66326\n251,-787\n248,-66845\n249,-66585\n246,-67108\n247,-66848\n244,-67371\n245,-67111\n242,-67633\n243,-67374\n240,-133432\n241,-67637\n");
			c.setMapName("Fire Ball");
			return c;
		} else if (type == TYPE_ICE)
		{
			ColorMap c = new ColorMap(
					"0,-14342875\n1,-16645374\n2,-16579581\n3,-16513789\n4,-16382460\n5,-16316667\n6,-16250874\n7,-16185081\n8,-16053496\n9,-15987703\n10,-15921910\n11,-15856117\n12,-15724788\n13,-15658995\n14,-15593202\n15,-15527410\n17,-15330288\n16,-15396081\n19,-15198446\n18,-15264239\n21,-15001324\n20,-15067117\n23,-14869738\n22,-14935531\n25,-14672616\n24,-14738409\n27,-14540774\n26,-14606824\n29,-14343653\n28,-14474982\n31,-14212067\n30,-14277860\n34,-13949152\n35,-13883359\n32,-14146274\n33,-14014945\n38,-13620188\n39,-13554396\n36,-13817566\n37,-13686237\n42,-13291481\n43,-13225688\n40,-13488603\n41,-13357274\n46,-12962773\n47,-12896724\n44,-13159895\n45,-13094102\n51,-12568017\n50,-12633809\n49,-12699602\n48,-12830931\n55,-12239309\n54,-12305102\n53,-12370895\n52,-12502224\n59,-11910345\n58,-11976138\n57,-12041931\n56,-12173516\n63,-11581638\n62,-11647431\n61,-11713223\n60,-11844552\n68,-11186881\n69,-11121088\n70,-10989759\n71,-10923966\n64,-11515845\n65,-11450052\n66,-11318723\n67,-11252930\n76,-10529210\n77,-10463417\n78,-10332088\n79,-10266295\n72,-10858173\n73,-10792380\n74,-10661052\n75,-10595259\n85,-9805745\n84,-9871794\n87,-9805745\n86,-9740209\n81,-10134709\n80,-10200502\n83,-9937587\n82,-10003380\n93,-10067375\n92,-10002095\n95,-10198446\n94,-10132911\n89,-9871024\n88,-9871024\n91,-10002095\n90,-9936560\n102,-10460076\n103,-10525612\n100,-10394797\n101,-10460333\n98,-10329261\n99,-10329261\n96,-10198446\n97,-10263726\n110,-10853034\n111,-10852778\n108,-10721963\n109,-10787498\n106,-10656427\n107,-10721963\n104,-10591148\n105,-10591148\n119,-11245736\n118,-11180200\n117,-11180200\n116,-11114664\n115,-11049129\n114,-10983849\n113,-10983849\n112,-10918314\n127,-11572901\n126,-11572902\n125,-11507366\n124,-11441830\n123,-11442086\n122,-11376551\n121,-11311015\n120,-11245479\n137,-12031138\n136,-11965603\n139,-12096418\n138,-12096418\n141,-12227489\n140,-12161954\n143,-12292769\n142,-12227233\n129,-11703717\n128,-11638437\n131,-11769252\n130,-11703716\n133,-11834532\n132,-11834788\n135,-11965603\n134,-11900067\n152,-12685470\n153,-12751006\n154,-12816542\n155,-12816285\n156,-12881821\n157,-12947357\n158,-12947357\n159,-13012892\n144,-12358305\n145,-12423840\n146,-12423840\n147,-12489120\n148,-12554655\n149,-12554655\n150,-12620191\n151,-12685471\n171,-13470873\n170,-13536409\n169,-13470874\n168,-13405594\n175,-12813713\n174,-13010579\n173,-13142165\n172,-13339287\n163,-13209243\n162,-13143707\n161,-13078172\n160,-13078172\n167,-13340058\n166,-13340058\n165,-13274523\n164,-13209243\n186,-11105150\n187,-10908028\n184,-11433601\n185,-11236479\n190,-10447990\n191,-10316661\n188,-10776698\n189,-10579576\n178,-12353676\n179,-12222090\n176,-12682127\n177,-12485005\n182,-11696517\n183,-11565187\n180,-12025224\n181,-11893638\n205,-8082524\n204,-8213853\n207,-7753816\n206,-7950938\n201,-8739427\n200,-8871013\n203,-8410975\n202,-8542561\n197,-9331050\n196,-9462380\n199,-9068135\n198,-9199464\n193,-9987953\n192,-10119539\n195,-9659502\n194,-9856623\n220,-5716801\n221,-5519679\n222,-5388350\n223,-5191228\n216,-6308168\n217,-6176838\n218,-6045253\n219,-5848387\n212,-6965327\n213,-6833742\n214,-6636876\n215,-6505290\n208,-7622486\n209,-7425365\n210,-7293779\n211,-7096913\n239,-2694175\n238,-2825505\n237,-3022627\n236,-3154213\n235,-3285542\n234,-3482664\n233,-3679786\n232,-3811116\n231,-3942701\n230,-4074031\n229,-4271153\n228,-4402739\n227,-4599604\n226,-4731190\n225,-4928312\n224,-5059642\n254,-328452\n255,-131587\n252,-657160\n253,-460038\n250,-920076\n251,-788490\n248,-1248527\n249,-1116941\n246,-1576979\n247,-1445649\n244,-1905686\n245,-1708564\n242,-2234138\n243,-2037016\n240,-2562589\n241,-2365467\n");
			c.setMapName("Ice");
			return c;
		} else if (type == TYPE_STONE)
		{
			ColorMap c = new ColorMap(
					"0,-16777216\n1,-16711423\n2,-16645631\n3,-16580094\n4,-16514045\n5,-16448508\n6,-16382716\n7,-16316923\n8,-16251130\n9,-16185337\n10,-16119544\n11,-16053752\n12,-15987959\n13,-15922166\n14,-15856373\n15,-15790580\n17,-15658995\n16,-15724788\n19,-15527409\n18,-15593202\n21,-15395824\n20,-15461617\n23,-15264238\n22,-15330031\n25,-15132653\n24,-15198445\n27,-15001067\n26,-15066860\n29,-14869481\n28,-14935274\n31,-14737896\n30,-14803689\n34,-14540517\n35,-14474725\n32,-14672103\n33,-14606310\n38,-14277602\n39,-14211810\n36,-14409188\n37,-14343395\n42,-14014431\n43,-13948638\n40,-14146017\n41,-14080224\n46,-13751260\n47,-13685467\n44,-13882846\n45,-13817053\n51,-13422296\n50,-13488089\n49,-13553882\n48,-13619674\n55,-13159125\n54,-13224918\n53,-13290710\n52,-13290967\n59,-12895954\n58,-12896211\n57,-12962003\n56,-13027796\n63,-12567247\n62,-12633039\n61,-12698832\n60,-12764625\n68,-12238283\n69,-12172746\n70,-12106953\n71,-12041160\n64,-12501454\n65,-12435661\n66,-12369868\n67,-12304075\n76,-11712196\n77,-11646404\n78,-11580611\n79,-11514818\n72,-11975367\n73,-11909575\n74,-11843782\n75,-11777989\n85,-11120061\n84,-11185854\n87,-10988476\n86,-11054268\n81,-11383232\n80,-11449025\n83,-11251647\n82,-11317440\n93,-10593719\n92,-10659512\n95,-10462133\n94,-10527926\n89,-10856890\n88,-10922683\n91,-10725304\n90,-10791097\n102,-10001584\n103,-9935791\n100,-10133169\n101,-10067376\n98,-10264755\n99,-10198962\n96,-10396340\n97,-10330548\n110,-9409961\n111,-9409705\n108,-9541547\n109,-9475754\n106,-9738413\n107,-9672876\n104,-9804462\n105,-9804205\n119,-8817826\n118,-8883619\n117,-8949412\n116,-9015205\n115,-9080997\n114,-9146790\n113,-9212583\n112,-9278376\n127,-8291484\n126,-8357277\n125,-8423070\n124,-8488862\n123,-8554655\n122,-8620448\n121,-8686241\n120,-8752033\n137,-7633552\n136,-7699346\n139,-7501966\n138,-7567759\n141,-7370379\n140,-7436173\n143,-7304329\n142,-7370122\n129,-8159898\n128,-8225691\n131,-8028312\n130,-8094105\n133,-7896725\n132,-7962518\n135,-7765139\n134,-7830932\n152,-6712190\n153,-6646397\n154,-6580604\n155,-6514811\n156,-6448761\n157,-6382968\n158,-6317175\n159,-6251382\n144,-7238536\n145,-7172743\n146,-7106950\n147,-7041156\n148,-6975363\n149,-6909570\n150,-6843777\n151,-6777984\n171,-5461863\n170,-5527657\n169,-5593450\n168,-5659243\n175,-5198690\n174,-5264484\n173,-5330277\n172,-5396070\n163,-5988209\n162,-6054002\n161,-6119795\n160,-6185589\n167,-5725036\n166,-5790830\n165,-5856623\n164,-5922416\n186,-4474965\n187,-4409172\n184,-4606552\n185,-4540758\n190,-4211536\n191,-4145743\n188,-4343379\n189,-4277586\n178,-5001311\n179,-4935518\n176,-5132897\n177,-5067104\n182,-4738138\n183,-4672345\n180,-4869724\n181,-4803931\n205,-3290174\n204,-3355968\n207,-3158588\n206,-3224381\n201,-3553347\n200,-3619140\n203,-3421761\n202,-3487554\n197,-3816520\n196,-3882313\n199,-3684934\n198,-3750727\n193,-4014157\n192,-4145742\n195,-3948106\n194,-4013900\n220,-2303276\n221,-2237483\n222,-2171690\n223,-2105897\n216,-2566449\n217,-2500656\n218,-2434863\n219,-2369069\n212,-2829622\n213,-2763829\n214,-2698036\n215,-2632242\n208,-3092795\n209,-3027001\n210,-2961208\n211,-2895415\n239,-1118485\n238,-1118743\n237,-1250072\n236,-1250329\n235,-1316122\n234,-1381915\n233,-1447965\n232,-1513758\n231,-1579551\n230,-1645344\n229,-1711137\n228,-1776931\n227,-1842724\n226,-1908517\n225,-1974310\n224,-2040103\n254,-131587\n255,-65794\n252,-263174\n253,-197380\n250,-394760\n251,-328967\n248,-526347\n249,-460553\n246,-657933\n247,-592140\n244,-789519\n245,-723726\n242,-921106\n243,-855313\n240,-1052692\n241,-986899\n");
			c.setMapName("Stone");
			return c;
		} else if (type == TYPE_ROSE)
		{
			ColorMap c = new ColorMap(
					"0,-14342875\n1,-16645887\n2,-16514558\n3,-16382973\n4,-16251644\n5,-16120059\n6,-15988730\n7,-15857401\n8,-15660280\n9,-15528951\n10,-15397366\n11,-15266037\n12,-15134708\n13,-14937587\n14,-14806258\n15,-14674929\n17,-14412015\n16,-14543344\n19,-14083565\n18,-14280430\n21,-13820651\n20,-13951980\n23,-13557737\n22,-13689322\n25,-13295079\n24,-13426408\n27,-12966629\n26,-13163494\n29,-12703715\n28,-12835044\n31,-12440801\n30,-12572386\n34,-11981022\n35,-11849693\n32,-12309472\n33,-12112607\n38,-11389658\n39,-11258329\n36,-11718108\n37,-11586779\n42,-10864086\n43,-10732757\n40,-11127000\n41,-10995415\n46,-10272721\n47,-10141393\n44,-10601172\n45,-10469843\n51,-9615564\n50,-9747149\n49,-9878478\n48,-10010064\n55,-9024456\n54,-9155785\n53,-9287370\n52,-9418699\n59,-8433092\n58,-8564677\n57,-8761542\n56,-8893127\n63,-7907520\n62,-8038849\n61,-8170178\n60,-8301763\n68,-7840702\n69,-7840446\n70,-7905726\n71,-7905726\n64,-7775935\n65,-7710143\n66,-7775679\n67,-7775423\n76,-8101053\n77,-8101053\n78,-8166333\n79,-8166076\n72,-7971006\n73,-7970750\n74,-8036029\n75,-8035773\n85,-8361403\n84,-8361660\n87,-8426427\n86,-8426683\n81,-8231100\n80,-8231356\n83,-8296380\n82,-8296636\n93,-8622010\n92,-8622010\n95,-8752570\n94,-8687290\n89,-8491707\n88,-8491963\n91,-8556730\n90,-8556987\n102,-8947640\n103,-8947384\n100,-8882617\n101,-8882361\n98,-8817337\n99,-8882873\n96,-8752314\n97,-8752057\n110,-9208247\n111,-9207991\n108,-9142967\n109,-9142967\n106,-9077944\n107,-9077688\n104,-9012920\n105,-9012664\n119,-9468342\n118,-9468598\n117,-9403318\n116,-9403574\n115,-9338294\n114,-9338294\n113,-9338551\n112,-9273271\n127,-9728948\n126,-9729204\n125,-9663669\n124,-9663925\n123,-9598645\n122,-9598901\n121,-9533621\n120,-9533877\n137,-8814263\n136,-8879543\n139,-8552887\n138,-8683447\n141,-8357048\n140,-8422072\n143,-8095417\n142,-8226232\n129,-9663412\n128,-9728948\n131,-9467573\n130,-9598389\n133,-9206198\n132,-9336757\n135,-9010102\n134,-9140918\n152,-7115707\n153,-6984892\n154,-6854076\n155,-6723516\n156,-6658237\n157,-6527421\n158,-6396861\n159,-6266046\n144,-7964857\n145,-7899577\n146,-7768762\n147,-7638202\n148,-7507386\n149,-7442107\n150,-7311547\n151,-7180731\n171,-4959425\n170,-5024705\n169,-5155521\n168,-5286080\n175,-4436675\n174,-4567490\n173,-4698050\n172,-4828866\n163,-5808831\n162,-5939391\n161,-6070206\n160,-6200766\n167,-5351360\n166,-5482176\n165,-5612736\n164,-5743551\n186,-3195334\n187,-3130054\n184,-3456710\n185,-3326150\n190,-2737863\n191,-2672840\n188,-2999495\n189,-2868679\n178,-4110020\n179,-3979204\n176,-4371395\n177,-4240835\n182,-3652805\n183,-3587525\n180,-3914180\n181,-3783365\n205,-2007199\n204,-2073506\n207,-1940121\n206,-2006428\n201,-2206892\n200,-2207663\n203,-2139814\n202,-2140585\n197,-2341304\n196,-2407611\n199,-2274226\n198,-2274997\n193,-2475717\n192,-2541767\n195,-2408383\n194,-2474690\n220,-1405297\n221,-1404526\n222,-1338219\n223,-1337191\n216,-1604989\n217,-1538682\n218,-1537911\n219,-1471604\n212,-1739401\n213,-1738631\n214,-1672324\n215,-1605760\n208,-1873558\n209,-1872787\n210,-1806480\n211,-1805708\n239,-668982\n238,-735289\n237,-736316\n236,-802623\n235,-803394\n234,-869701\n233,-936008\n232,-936779\n231,-1003086\n230,-1003857\n229,-1070421\n228,-1136728\n227,-1137499\n226,-1203806\n225,-1204577\n224,-1270884\n254,-67079\n255,-66308\n252,-134413\n253,-133386\n250,-267027\n251,-200720\n248,-334106\n249,-267798\n246,-401184\n247,-334877\n244,-468518\n245,-401955\n242,-535596\n243,-534825\n240,-668211\n241,-601903\n");
			c.setMapName("Rose");
			return c;
		} else if (type == TYPE_ICE_STORM)
		{
			ColorMap c = new ColorMap(
					"0,-14342875\n1,-16777212\n2,-16776953\n3,-16776950\n4,-16776691\n5,-16776688\n6,-16776430\n7,-16710891\n8,-16710632\n9,-16710629\n10,-16710370\n11,-16710368\n12,-16710109\n13,-16710106\n14,-16709847\n15,-16709844\n17,-16709583\n16,-16709585\n19,-16709321\n18,-16709324\n21,-16643523\n20,-16643526\n23,-16643261\n22,-16643265\n25,-16643000\n24,-16643003\n27,-16642738\n26,-16642741\n29,-16642477\n28,-16642479\n31,-16642215\n30,-16642218\n34,-16576158\n35,-16576156\n32,-16641956\n33,-16576417\n38,-16575635\n39,-16575632\n36,-16575897\n37,-16575894\n42,-16575112\n43,-16575109\n40,-16575374\n41,-16575371\n46,-16509053\n47,-16509050\n44,-16574850\n45,-16574848\n51,-16508527\n50,-16508529\n49,-16508788\n48,-16508791\n55,-16508003\n54,-16508006\n53,-16508265\n52,-16508268\n59,-16441944\n58,-16441947\n57,-16507741\n56,-16507745\n63,-16441421\n62,-16441423\n61,-16441682\n60,-16441685\n68,-16374598\n69,-16308805\n70,-16308548\n71,-16308548\n64,-16441162\n65,-16440904\n66,-16375112\n67,-16374855\n76,-16176191\n77,-16175935\n78,-16110142\n79,-16109885\n72,-16242499\n73,-16242498\n74,-16242241\n75,-16176448\n85,-15977272\n84,-15977529\n87,-15911222\n86,-15911479\n81,-16043835\n80,-16109628\n83,-16043322\n82,-16043579\n93,-15778610\n92,-15778866\n95,-15712560\n94,-15778353\n89,-15845173\n88,-15910966\n91,-15844659\n90,-15844916\n102,-15579690\n103,-15579433\n100,-15645740\n101,-15579947\n98,-15646253\n99,-15645997\n96,-15712303\n97,-15712046\n110,-15381028\n111,-15381027\n108,-15447333\n109,-15447077\n106,-15513127\n107,-15447334\n104,-15513641\n105,-15513384\n119,-15182364\n118,-15182621\n117,-15248414\n116,-15248671\n115,-15314464\n114,-15314720\n113,-15314977\n112,-15380770\n127,-14983702\n126,-15049495\n125,-15049751\n124,-15050008\n123,-15115801\n122,-15116058\n121,-15116315\n120,-15182108\n137,-14717203\n136,-14783251\n139,-14650898\n138,-14716691\n141,-14649874\n140,-14650386\n143,-14583569\n142,-14583826\n129,-14982933\n128,-14983445\n131,-14916628\n130,-14917141\n133,-14850068\n132,-14850580\n135,-14783763\n134,-14849812\n152,-14317071\n153,-14316815\n154,-14250767\n155,-14250254\n156,-14184206\n157,-14183950\n158,-14117902\n159,-14117389\n144,-14517521\n145,-14517009\n146,-14450961\n147,-14450448\n148,-14450192\n149,-14384144\n150,-14383632\n151,-14317583\n171,-13784330\n170,-13784587\n169,-13850635\n168,-13851147\n175,-13651209\n174,-13717258\n173,-13717770\n172,-13718282\n163,-13984524\n162,-14050317\n161,-14050829\n160,-14116877\n167,-13917195\n166,-13917452\n165,-13917964\n164,-13984012\n186,-13318662\n187,-13318150\n184,-13384967\n185,-13384455\n190,-13251077\n191,-13185285\n188,-13317638\n189,-13251590\n178,-13584393\n179,-13518344\n176,-13650697\n177,-13584649\n182,-13451527\n183,-13451015\n180,-13517832\n181,-13517320\n205,-10495236\n204,-10692100\n207,-10101764\n206,-10298628\n201,-11282436\n200,-11479301\n203,-10888964\n202,-11085828\n197,-12135173\n196,-12332037\n199,-11741701\n198,-11938565\n193,-12987909\n192,-13119237\n195,-12528901\n194,-12725765\n220,-7412227\n221,-7215619\n222,-7018755\n223,-6756355\n216,-8199428\n217,-8002819\n218,-7805955\n219,-7609091\n212,-9052164\n213,-8855556\n214,-8658692\n215,-8396292\n208,-9839364\n209,-9642500\n210,-9445892\n211,-9249028\n239,-3476482\n238,-3673346\n237,-3935746\n236,-4132610\n235,-4329218\n234,-4526082\n233,-4722946\n232,-4919811\n231,-5116419\n230,-5313283\n229,-5575683\n228,-5772547\n227,-5969155\n226,-6166019\n225,-6362883\n224,-6559491\n254,-393473\n255,-196865\n252,-852737\n253,-590337\n250,-1246209\n251,-1049601\n248,-1639938\n249,-1443073\n246,-2033410\n247,-1836802\n244,-2492674\n245,-2230274\n242,-2886146\n243,-2689538\n240,-3279874\n241,-3083010\n"

			);
			c.setMapName("Ice Storm");
			return c;
		} else if (type == TYPE_TIVI)
		{
			ColorMap c = new ColorMap(
					"0,-16777073\n1,-16777070\n2,-16777067\n3,-16777064\n4,-16777061\n5,-16777058\n6,-16777053\n7,-16777049\n8,-16777044\n9,-16777040\n10,-16777035\n11,-16777031\n12,-16777027\n13,-16777022\n14,-16777018\n15,-16777013\n16,-16777010\n17,-16777007\n18,-16777004\n19,-16777001\n20,-16776997\n21,-16776995\n22,-16776992\n23,-16776989\n24,-16776986\n25,-16776983\n26,-16776980\n27,-16776977\n28,-16776973\n29,-16776970\n30,-16776966\n31,-16776963\n32,-16776706\n33,-16776450\n34,-16775938\n35,-16775682\n36,-16775170\n37,-16774657\n38,-16774145\n39,-16773633\n40,-16773121\n41,-16772609\n42,-16772097\n43,-16771073\n44,-16770049\n45,-16769025\n46,-16768001\n47,-16766977\n48,-16765697\n49,-16764417\n50,-16763137\n51,-16761857\n52,-16760577\n53,-16759297\n54,-16758017\n55,-16756737\n56,-16755457\n57,-16754177\n58,-16753153\n59,-16752129\n60,-16750849\n61,-16749825\n62,-16748801\n63,-16747521\n64,-16745985\n65,-16744449\n66,-16742913\n67,-16741377\n68,-16740097\n69,-16739073\n70,-16738049\n71,-16737025\n72,-16735745\n73,-16734721\n74,-16733697\n75,-16732929\n76,-16731905\n77,-16730881\n78,-16729857\n79,-16728577\n80,-16727297\n81,-16726017\n82,-16724993\n83,-16723713\n84,-16722689\n85,-16721665\n86,-16720641\n87,-16719617\n88,-16718849\n89,-16717826\n90,-16717058\n91,-16716290\n92,-16715266\n93,-16714498\n94,-16582659\n95,-16385797\n96,-16188680\n97,-15926282\n98,-15729164\n99,-15532046\n100,-15269908\n101,-15007769\n102,-14745630\n103,-14483491\n104,-14221353\n105,-13959213\n106,-13631538\n107,-13369398\n108,-13041723\n109,-12779583\n110,-12517443\n111,-12320839\n112,-12058700\n113,-11862096\n114,-11599956\n115,-11337816\n116,-11075675\n117,-10813534\n118,-10551394\n119,-10289253\n120,-10027113\n121,-9699438\n122,-9437298\n123,-9109623\n124,-8847483\n125,-8519808\n126,-8257668\n127,-8061063\n128,-7798923\n129,-7536783\n130,-7274643\n131,-7078039\n132,-6815900\n133,-6553760\n134,-6291621\n135,-6029482\n136,-5767342\n137,-5439665\n138,-5177525\n139,-4915385\n140,-4587708\n141,-4325568\n142,-4063428\n143,-3801288\n144,-3539148\n145,-3277008\n146,-3080403\n147,-2818262\n148,-2556121\n149,-2359516\n150,-2097375\n151,-1900770\n152,-1638630\n153,-1376490\n154,-1179887\n155,-917747\n156,-721143\n157,-525305\n158,-460283\n159,-329724\n160,-199422\n161,-68864\n162,-4352\n163,-5376\n164,-6400\n165,-7680\n166,-8704\n167,-9728\n168,-10496\n169,-11264\n170,-12032\n171,-12800\n172,-13568\n173,-14848\n174,-15872\n175,-17152\n176,-18176\n177,-19456\n178,-20480\n179,-21504\n180,-22528\n181,-23552\n182,-24576\n183,-25856\n184,-26880\n185,-28160\n186,-29184\n187,-30464\n188,-31488\n189,-32256\n190,-33280\n191,-34048\n192,-35072\n193,-35840\n194,-37120\n195,-38144\n196,-39168\n197,-40192\n198,-41216\n199,-42240\n200,-43008\n201,-44032\n202,-44800\n203,-45824\n204,-46848\n205,-47872\n206,-48640\n207,-49664\n208,-50688\n209,-51712\n210,-52480\n211,-53504\n212,-54528\n213,-55296\n214,-56576\n215,-57856\n216,-59136\n217,-60160\n218,-61440\n219,-128000\n220,-194304\n221,-260352\n222,-326656\n223,-392960\n224,-524288\n225,-786432\n226,-1048576\n227,-1245184\n228,-1507328\n229,-1769472\n230,-2031616\n231,-2293760\n232,-2555904\n233,-2818048\n234,-3014656\n235,-3276800\n236,-3538944\n237,-3735552\n238,-3997696\n239,-4259840\n240,-4521984\n241,-4849664\n242,-5111808\n243,-5439488\n244,-5701632\n245,-6029312\n246,-6225920\n247,-6488064\n248,-6750208\n249,-7012352\n250,-7274496\n251,-7471104\n252,-7733248\n253,-7995392\n254,-8257536\n255,-8454144");
			c.setMapName("Tivi Map");
			return c;
		} else if (type == TYPE_GLOW)
		{
			ColorMap c = new ColorMap("0,-16777216\n1,-16646144\n2,-16515072\n3,-16384000\n4,-16252672\n5,-16121599\n6,-15990527\n7,-15859199\n8,-15728127\n9,-15597054\n10,-15465982\n11,-15334654\n12,-15203582\n13,-15072510\n14,-14941181\n15,-14810109\n16,-14744573\n17,-14613244\n18,-14482172\n19,-14351100\n20,-14220028\n21,-14088699\n22,-13957627\n23,-13826555\n24,-13695226\n25,-13564154\n26,-13433082\n27,-13301753\n28,-13170681\n29,-13039609\n30,-12842745\n31,-12711672\n32,-12580600\n33,-12449272\n34,-12252663\n35,-12121335\n36,-11990263\n37,-11859190\n38,-11727862\n39,-11531254\n40,-11400182\n41,-11268853\n42,-11137781\n43,-11006709\n44,-10875381\n45,-10744308\n46,-10613236\n47,-10481908\n48,-10416372\n49,-10285300\n50,-10154227\n51,-10022899\n52,-9891827\n53,-9760755\n54,-9629426\n55,-9498354\n56,-9301746\n57,-9170418\n58,-9039345\n59,-8908273\n60,-8776945\n61,-8645872\n62,-8514544\n63,-8317936\n64,-8186863\n65,-8055535\n66,-7924463\n67,-7793391\n68,-7662062\n69,-7530990\n70,-7399662\n71,-7268334\n72,-7137262\n73,-7071470\n74,-6940397\n75,-6809069\n76,-6677997\n77,-6546669\n78,-6415597\n79,-6284269\n80,-6153197\n81,-6087404\n82,-5956076\n83,-5890284\n84,-5758956\n85,-5693164\n86,-5561836\n87,-5496044\n88,-5364716\n89,-5298924\n90,-5167596\n91,-5101804\n92,-4970476\n93,-4904684\n94,-4773356\n95,-4707564\n96,-4641516\n97,-4575724\n98,-4509676\n99,-4378348\n100,-4312300\n101,-4246252\n102,-4180460\n103,-4114412\n104,-4048620\n105,-3917036\n106,-3851244\n107,-3785196\n108,-3719148\n109,-3653100\n110,-3587308\n111,-3586796\n112,-3520748\n113,-3454700\n114,-3388652\n115,-3322604\n116,-3256556\n117,-3256300\n118,-3190252\n119,-3124204\n120,-3058156\n121,-2992108\n122,-2926060\n123,-2925548\n124,-2859500\n125,-2793452\n126,-2727404\n127,-2661356\n128,-2595564\n129,-2529516\n130,-2463468\n131,-2397420\n132,-2331372\n133,-2330860\n134,-2264812\n135,-2198763\n136,-2198250\n137,-2132458\n138,-2131945\n139,-2065897\n140,-1999848\n141,-1999335\n142,-1933543\n143,-1933030\n144,-1866982\n145,-1866469\n146,-1800420\n147,-1800164\n148,-1734115\n149,-1733602\n150,-1667554\n151,-1667041\n152,-1666528\n153,-1600735\n154,-1600222\n155,-1534173\n156,-1533661\n157,-1467612\n158,-1467099\n159,-1401050\n160,-1400537\n161,-1400281\n162,-1334231\n163,-1333973\n164,-1333460\n165,-1267666\n166,-1267153\n167,-1266895\n168,-1200846\n169,-1200588\n170,-1200074\n171,-1199817\n172,-1133767\n173,-1133510\n174,-1132996\n175,-1067203\n176,-1066689\n177,-1066431\n178,-1000381\n179,-1000124\n180,-999610\n181,-999352\n182,-933303\n183,-933045\n184,-932531\n185,-866737\n186,-866224\n187,-865966\n188,-799916\n189,-799658\n190,-799400\n191,-799142\n192,-798883\n193,-732833\n194,-732575\n195,-732317\n196,-732058\n197,-666264\n198,-665750\n199,-665492\n200,-665233\n201,-664975\n202,-599181\n203,-598923\n204,-598665\n205,-598406\n206,-532612\n207,-532354\n208,-532096\n209,-531581\n210,-531323\n211,-465529\n212,-465271\n213,-465012\n214,-464754\n215,-398960\n216,-398701\n217,-398699\n218,-398440\n219,-398182\n220,-397923\n221,-397665\n222,-332126\n223,-331868\n224,-331609\n225,-331351\n226,-331092\n227,-330833\n228,-330831\n229,-265036\n230,-265034\n231,-265032\n232,-265029\n233,-264771\n234,-264768\n235,-264766\n236,-264763\n237,-264761\n238,-264502\n239,-264500\n240,-264497\n241,-264495\n242,-264236\n243,-264234\n244,-264231\n245,-263973\n246,-263970\n247,-263967\n248,-263965\n249,-263706\n250,-263704\n251,-263701\n252,-263442\n253,-263440\n254,-263437\n255,-263178");
			c.setMapName("Glow");
			return c;
		} else
			throw new InvalidParameterException("No such map");
	}

	public int[] getRGBValues()
	{
		int[] rst = new int[map.size()];

		for (int i = 0; i < map.size(); i++)
		{
			rst[i] = map.get(i).getRGB();
		}
		return rst;
	}

	protected void setColor(int value, Color c)
	{
		map.put(value, c);
	}

	public String getMapName()
	{
		return mapName;
	}

	public void setMapName(String mapName)
	{
		this.mapName = mapName;
	}

	public void setMap(HashMap<Integer, Color> map)
	{
		this.map = map;
	}

	public static ColorMapChooser getColorMapChooser()
	{
		return new ColorMapChooser();
	}
}
